﻿using MongoDB.Bson;
using MongoDB.Driver;

namespace CommonUtils
{
    //https://mongodb.github.io/mongo-csharp-driver/2.10/getting_started/quick_tour/
    public static class MongoDb
    {
        public static void Test()
        {
            // To directly connect to a single MongoDB server
            // (this will not auto-discover the primary even if it's a member of a replica set)
            //var client = new MongoClient();

            // or use a connection string
            var client = new MongoClient("mongodb://localhost:27017");

            // or, to connect to a replica set, with auto-discovery of the primary, supply a seed list of members
            //var client = new MongoClient("mongodb://localhost:27017,localhost:27018,localhost:27019");

            //Get a Database
            var database = client.GetDatabase("foo");

            //Get a Collection
            var collection = database.GetCollection<BsonDocument>("bar");
        }
    }
}
